BrowserView

@Composable()
public final static Unit BrowserView(BrowserViewState state, Modifier modifier)
@Composable()
public final static Unit BrowserView(BrowserViewState state, Modifier modifier)

Displays the browser content from the provided state.

This composable is stateless, meaning that users are responsible for managing the state. A convenient way to create the state is by using rememberBrowserViewState, which handles cleanup automatically. An example usage:

val state = rememberBrowserViewState(browser)
BrowserView(state)

Alternatively, the state can be created and remembered directly, though it must be manually closed when no longer needed:

val state = remember(browser) {
BrowserViewState(browser, scope, window)
}
BrowserView(state)
DisposableEffect(state) {
onDispose {
state.close()
}
}

A state instance can only be associated with one BrowserView at a time. An attempt to display multiple views with the same state leads to a runtime exception.

The passed modifier supports all the same options as the Box composable. You can use it to adjust properties like size, padding, alignment, and more.

Since

8.0.0

Parameters

state

The state of the browser view.

modifier

The modifier to be applied to the layout.


@Composable()
public final static Unit BrowserView(WindowScope $self, Browser browser, Modifier modifier, DragAndDropOptions dragAndDropOptions)
@Composable()
public final static Unit BrowserView(WindowScope $self, Browser browser, Modifier modifier, DragAndDropOptions dragAndDropOptions)

Displays the content of the given browser.

This composable is stateful, meaning it manages the state internally. The state is created when the BrowserView enters the composition, and it is released when the view leaves the composition. Please note that the view recreates the state and recomposes for each different browser instance provided. State preservation can be achieved by using state hoisting.

This composable needs a WindowScope to access the native AWT window. This access enables the BrowserView to utilize native AWT capabilities, such as handling specific window events and accessing window properties.

Please note, as for now, the composable supports only OFF_SCREEN rendering mode. Passing a browser instance with HARDWARE_ACCELERATED mode leads to a runtime exception. See also: Rendering modes.

Since

8.0.0

Parameters

browser

The browser, whose content is to be displayed.

modifier

The modifier to be applied to the layout.

dragAndDropOptions

The configuration options for the drag-and-drop functionality.